const Path = require('path')

const { createUpload } = require('../service/upload.service')

class UploadController {

    async upload(ctx) {
        const file = ctx.request.files.file
        const path = Path.basename(file.path)
        const expId = ctx.request.params.expId
        const res = await createUpload({ expId, path })

        ctx.body = {
            code: '200',
            message: '上传成功',
            data: res
        }
    }


}

module.exports = new UploadController()